home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
PASCAL
/
0826.ZIP
/
TREF2D.ARC
/
T-REFCH5.DOC
< prev
next >
Wrap
Text File
|
1987-09-20
|
5KB
|
133 lines
Chapter V - Using T-Ref
There are many reasons for using T-Ref besides simply listing the source
or getting a comprehensive cross reference. In this chapter, we introduce
three additional ways to take advantage of T-Ref's flexibility. First, we
show how versioned software can be formatted at the completion of a version to
easily identify modifications to the source code. Next, we describe how
unused identifiers can be found to trim down the data segment size. Finally,
we address a vital question for many programs developed today: portability to
other systems.
Software Versions:
Many programs are developed on a version basis - a portion of the code is
completed and debugged before additional features or enhancements are made.
For debugging the enhancements made to a version, it is often important to be
able to recognize modifications to a working version for debugging purposes.
As described in Chapter II above, T-Ref can be used to create new (compi-
lable) source code. This is done by specifying an output file; turning line,
lexical, and block numbering "Off"; page numbering and headers "Off"; setting
source code include files to "No"; and turning "Off" the cross reference
lister completely. By running T-Ref against the source code files and placing
the 'Reserve Words' and 'Identifier' fields to desired settings, you will get
a new source listing. (You can set the 'Active Procedure' field to "On" if
you wish; however, we recommend you reserve this option primarily for listing
source code, since it will significantly increase the space the source would
take up on disk.)
Now, by having each completed software version reformatted to be in all
caps "Upper" or all small letters "Lower" and modifying the code with the
opposite type, it is simple to find changes and additions to the code. It
should be noted here that it does not necessarily matter which letter type the
code is in, since T-Ref will reformat the code again when routing a copy to a
printer or print hold file.
Program Data Trimming:
It is common to see a direct relationship between program size and data
size. As the size of a program increases, so normally does the data size. As
code is added and deleted, it becomes extremely difficult to track constants
and variables and their uses. Long lists of unused identifiers (no matter
what their type) detracts from the readability of any program. To keep the
data size to a minimum, it is good programming practice to illiminate those
identifiers declared but never used.
This, however, is easier said than done. We have discovered that even
the best programmers overlook this at least once when programs reach a length
of several thousand lines of code.
To list unused identifiers with T-Ref, turn "On" the cross reference
lister and set each of the basic type fields to "PrgDf" "Unused". Running
T-Ref against the source code will give you a complete list of identifiers
declared within the program but not used.
Portability Considerations:
A major consideration of many software developers once a program is
completed on one computer system is how to port it to other systems. If the
19
environment of the development system is different from the target system (or
if there is some measure of incompatibility between the development and target
systems), then porting may be more complex than just porting source code to
the target system and recompiling. This is precisely the case when the source
is in Pascal. Even when the environment of the target systems include a Turbo
Pascal compiler, difficulties arise due to differences in the implementation
of the language. Some of the functions and procedures for example supported
under the IBM-PC version are not available under other systems (especially
CP/M systems). This necessitates library packages or changes in the code to
compensate for these differences. If another Pascal compiler is required on
the target system, of course this problem is compounded.
The question becomes which standard (system defined) identifiers should
be considered and where and how often are those identifiers used. T-Ref can
search the source files and list them. By turning the cross reference lister
"On" and setting each of the six basic type fields to "SysDf" "Used", T-Ref
will give a cross reference of all system defined identifiers (those that may
need to be considered) used by the program and the lines they are used on.
As you can see, selectivity in a cross reference lister can greatly
minimize work time. You may find other ways of using T-Ref to your advantage
as we are discovering still.
20